﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="QLNguoiDungCN.ascx.cs"
    Inherits="QLNguoiDungCN" %>
<table width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td align="center">
            <asp:Panel ID="pnUserGrid" runat="server">
                <asp:Button ID="Button1" runat="server" Text="Thêm mới" OnClick="cmdAddUser_Click">
                </asp:Button>
                <asp:DataGrid ID="dgUser" runat="server" Width="100%" AutoGenerateColumns="False"
                    PageSize="20">
                    <PagerStyle Mode="NumericPages"></PagerStyle>
                    <AlternatingItemStyle CssClass="DarkRow"></AlternatingItemStyle>
                    <ItemStyle CssClass="LightRow"></ItemStyle>
                    <HeaderStyle Font-Bold="true" CssClass="HeaderRow"></HeaderStyle>
                    <Columns>
                        <asp:BoundColumn DataField="User_Id" Visible="False" HeaderText="User Id"></asp:BoundColumn>
                        <asp:BoundColumn DataField="brn_code" HeaderText="Chi nhánh">
                            <HeaderStyle></HeaderStyle>
                        </asp:BoundColumn>
                        <asp:BoundColumn DataField="quyen" HeaderText="Quyền">
                            <HeaderStyle></HeaderStyle>
                        </asp:BoundColumn>
                        <asp:BoundColumn DataField="User_Name" HeaderText="Tài khoản">
                            <HeaderStyle CssClass="HeaderRow"></HeaderStyle>
                        </asp:BoundColumn>
                        <asp:BoundColumn DataField="User_FullName" HeaderText="Họ và tên">
                            <HeaderStyle></HeaderStyle>
                        </asp:BoundColumn>
                        <asp:BoundColumn DataField="status" Visible="false" HeaderText="Trạng thái"></asp:BoundColumn>
                        <asp:TemplateColumn>
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            <ItemTemplate>
                                <asp:Button CausesValidation="False" ID="cmdEdit" runat="server" Text="Sửa" Width="50"
                                    CommandName="cmdEdit"></asp:Button>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn>
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            <ItemTemplate>
                                <asp:Button CausesValidation="False" ID="cmdReset" runat="server" Text="Đặt lại pass"
                                    Width="120" CommandName="cmdReset"></asp:Button>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn>
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            <ItemTemplate>
                                <asp:Button CausesValidation="False" ID="cmdDelete" runat="server" Text="Xóa" Width="40"
                                    CommandName="cmdDelete"></asp:Button>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Active/Deactive">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            <ItemTemplate>
                                <asp:ImageButton runat="server" ID="cmdLock" CommandName="cmdLock" ToolTip="Active/Deactive this user"/>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                    </Columns>
                </asp:DataGrid>
                <asp:Button ID="cmdAddUser" runat="server" Text="Thêm mới" OnClick="cmdAddUser_Click">
                </asp:Button>
            </asp:Panel>
            <asp:Panel ID="pnEditUser" runat="server" Style="text-align: center;" Width="500px">
                <table class="Tablestyle" style="border-right: gray 1px solid; border-top: gray 1px solid;
                    border-left: gray 1px solid; border-bottom: gray 1px solid" cellspacing="1" cellpadding="0"
                    width="500" border="0">
                    <tr class="trStyle">
                        <td class="tdStyle" style="color: blue" align="center" colspan="2">
                            <asp:Label ID="lblUpdateStatus" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="tdStyle" width="30%">
                        </td>
                        <td class="tdStyle" width="70%">
                            <asp:TextBox ID="txtID" Width="100%" runat="server" Visible="False" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" style="height: 24px">
                            Chi nhánh<asp:SqlDataSource ID="dsChiNhanh" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
                                ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommand="select MaKho, MaKho+' - '+ TenKho as TenKho from makho where makhocaptren=@Brn_Code and makho not in (select User_name from users) or MaKho=@Brn_Code&#13;&#10;/*&#13;&#10;select branchCode, branchcode+' - '+isnull(branchName,'') as branchName from brnStatus where &#13;&#10;(branchCode=@Brn_Code and HO_Branch <>@Brn_Code) or (branchCode<>@Brn_Code and HO_Branch =@Brn_Code) or branchCode=@Brn_Code&#13;&#10;*/">
                                <SelectParameters>
                                    <asp:SessionParameter Type="String" DefaultValue="" Name="Brn_Code" SessionField="Brn_Code" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </td>
                        <td class="tdStyle" style="height: 24px">
                            <asp:DropDownList ID="cboChiNhanh" runat="server" Width="100%" DataSourceID="dsChiNhanh"
                                DataTextField="TenKho" DataValueField="MaKho">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" style="height: 21px; text-align: left;">
                            Tên đăng nhập <span style="color: #ff0033">*</span>
                        </td>
                        <td class="tdStyle" style="height: 21px">
                            <asp:TextBox ID="txtUserName" Width="100%" runat="server" MaxLength="11" ToolTip="Tên đăng nhập tối đa 11 ký tự"></asp:TextBox>
                        </td>
                    </tr>
                    <%-- 
						<TR class="trStyle" id="trKSV" runat="server">
							<TD class="SubHead">Thuộc KSV</TD>
							<TD class="tdStyle">
								<asp:DropDownList id="cboKSV" Runat="server" Width="100%" DataValueField="User_Name" DataTextField="UserNameAndFullName" ToolTip="Chọn KSV trực tiếp quản lý TTV này."></asp:DropDownList></TD>
						</TR>
						--%>
                    <tr class="trStyle" runat="server" id="trPass1">
                        <td class="SubHead" style="text-align: left">
                            Mật khẩu <span style="color: #ff0033">*</span>
                        </td>
                        <td class="tdStyle" align="left">
                            <asp:TextBox ID="txtPassword" Width="100%" runat="server" TextMode="Password"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle" runat="server" id="trPass2">
                        <td class="SubHead" style="text-align: left">
                            Gõ lại mật khẩu <span style="color: #ff0033">*</span>
                        </td>
                        <td class="tdStyle" align="left">
                            <asp:TextBox ID="txtPassword2" Width="100%" runat="server" TextMode="Password"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" style="text-align: left">
                            Họ tên <span style="color: #ff0033">*</span>
                        </td>
                        <td class="tdStyle">
                            <asp:TextBox ID="txtFullName" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" style="text-align: left">
                            Email
                        </td>
                        <td class="tdStyle">
                            <asp:TextBox ID="txtEmail" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr runat="server" id="trNgaySinh" visible="false" class="trStyle">
                        <td class="SubHead" style="text-align: left">
                            Ngày sinh
                        </td>
                        <td class="tdStyle">
                            <asp:TextBox ID="txtBirthday" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr runat="server" id="trDiaChi" visible="false" class="trStyle">
                        <td class="SubHead" style="text-align: left">
                            Địa chỉ
                        </td>
                        <td class="tdStyle">
                            <asp:TextBox ID="txtAddress" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr runat="server" id="trDienThoai" visible="false" class="trStyle">
                        <td class="SubHead" style="height: 24px; text-align: left;">
                            Điện thoại
                        </td>
                        <td class="tdStyle" style="height: 24px">
                            <asp:TextBox ID="txtPhone" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" style="height: 24px; text-align: left;">
                            Số CMT nhân dân
                        </td>
                        <td class="tdStyle" style="height: 24px">
                            <asp:TextBox ID="txtCMT" Width="100%" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead" colspan="2" style="height: 24px; text-align: left;">
                            &nbsp;
                        </td>
                    </tr>
                    <tr align="center" style="display: none">
                        <td colspan="2" class="label">
                            Các quyền của nhóm<br />
                            <asp:ListBox ID="lstQuyen" runat="server" Rows="8" SelectionMode="Single" Width="300px">
                            </asp:ListBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td align="center" colspan="2">
                            <span style="color: red; font-family: arial">
                                <asp:Label ID="lblError" runat="server"></asp:Label>
                            </span>
                            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtPassword2"
                                ControlToValidate="txtPassword" Enabled="true" ErrorMessage="Hai mật khẩu phải trùng nhau!"
                                Operator="Equal"></asp:CompareValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="tdStyle" colspan="2" style="height: 24px">
                            <asp:Button ID="cmdUpdate" runat="server" CausesValidation="true" OnClick="cmdUpdate_Click"
                                Text="Cập nhật" Width="72px" />
                            &nbsp;<asp:Button ID="cmdQuyen" runat="server" CausesValidation="False" OnClick="cmdQuyen_Click"
                                Text="Phân quyền" Visible="False" Width="87px" />
                            <asp:Button ID="cmdCancel" runat="server" CausesValidation="False" OnClick="cmdCancel_Click"
                                Text="Thoát" Width="72px" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            &nbsp;
            <asp:Panel ID="pnQuyen_Nhom" runat="server" Visible="False" Width="600px">
                <table class="tableStyle" cellspacing="1" cellpadding="5" width="600" align="center"
                    border="0">
                    <tr class="trStyle">
                        <td class="biglabel1" align="center" colspan="3">
                            PHÂN QUYỀN NGƯỜI DÙNG
                        </td>
                    </tr>
                    <tr class="trStyle" align="center">
                        <td class="BigLabel1" width="50%">
                            Danh sách các vai trò
                        </td>
                        <td width="50">
                        </td>
                        <td class="BigLabel1" width="50%">
                            Danh sách vai trò được nhận
                        </td>
                    </tr>
                    <tr class="trStyle" align="center">
                        <td>
                            <asp:ListBox ID="lstVaiTro1" Width="100%" runat="server" DataValueField="Group_Id"
                                DataTextField="Group_Description" SelectionMode="Multiple" Rows="6"></asp:ListBox>
                        </td>
                        <td valign="middle">
                            <asp:Button ID="btnAddVaiTro" Width="45px" Text=">>" runat="server" CausesValidation="False"
                                OnClick="btnAddVaiTro_Click"></asp:Button><br>
                            <asp:Button ID="btnRemoveVaiTro" Width="45px" Text="<<" runat="server" CausesValidation="False"
                                OnClick="btnRemoveVaiTro_Click"></asp:Button>
                        </td>
                        <td>
                            <asp:ListBox ID="lstVaiTro2" Width="100%" runat="server" DataValueField="Group_Id"
                                DataTextField="Group_Description" SelectionMode="Multiple" Rows="6"></asp:ListBox>
                        </td>
                    </tr>
                    <tr runat="server" visible="false" class="trStyle" align="center">
                        <td class="BigLabel1" width="50%">
                            Các chức năng của hệ thống
                        </td>
                        <td width="50">
                        </td>
                        <td class="BigLabel1" width="50%">
                            Các chức năng được truy cập
                        </td>
                    </tr>
                    <tr runat="server" visible="false" class="trStyle" align="center">
                        <td>
                            <asp:ListBox ID="lstQuyen1" Width="100%" runat="server" SelectionMode="Multiple"
                                Rows="10"></asp:ListBox>
                        </td>
                        <td valign="middle">
                            <asp:Button ID="btnAddQuyen" Width="45px" Text=">>" runat="server" CausesValidation="False"
                                OnClick="btnAddQuyen_Click"></asp:Button><br>
                            <asp:Button ID="btnRemoveQuyen" Width="45px" Text="<<" runat="server" CausesValidation="False"
                                OnClick="btnRemoveQuyen_Click"></asp:Button>
                        </td>
                        <td>
                            <asp:ListBox ID="lstQuyen2" Width="100%" runat="server" SelectionMode="Multiple"
                                Rows="10"></asp:ListBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="3">
                            <asp:Button ID="Button5" Text="Quay lại" runat="server" CausesValidation="False"
                                OnClick="Button5_Click"></asp:Button>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="pnResetPassword" runat="server">
                <table class="Tablestyle" style="border-right: gray 1px solid; border-top: gray 1px solid;
                    border-left: gray 1px solid; border-bottom: gray 1px solid" cellspacing="1" cellpadding="0"
                    width="500" border="0">
                    <tr class="trStyle">
                        <td class="tdStyle" style="color: blue" align="center" colspan="2">
                            <asp:Label ID="lblResetPassword" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="tdStyle" width="30%">
                        </td>
                        <td class="tdStyle" width="70%">
                            <asp:TextBox ID="txtIdReset" Width="100%" runat="server" Visible="False" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead">
                            Tên đăng nhập
                        </td>
                        <td class="tdStyle">
                            <asp:Label ID="lblTenDangnhap" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td class="SubHead">
                            Mật khẩu
                        </td>
                        <td class="tdStyle" align="left">
                            <asp:TextBox ID="txtPassReset" Width="100%" runat="server" TextMode="Password"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle" align="left">
                        <td class="SubHead" style="height: 24px">
                            Gõ lại mật khẩu
                        </td>
                        <td class="tdStyle" align="left" style="height: 24px">
                            <asp:TextBox ID="txtPassReset2" Width="100%" runat="server" TextMode="Password"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="trStyle">
                        <td align="center" colspan="2" style="height: 19px">
                            <span style="color: red; font-family: arial">
                                <asp:Label ID="Label2" runat="server"></asp:Label></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdStyle" align="center" colspan="2">
                            <asp:Button ID="btnReset" Width="72px" Text="Cập nhật" runat="server" CausesValidation="true"
                                OnClick="btnReset_Click"></asp:Button>
                            <asp:Button ID="btnBack" Width="72px" Text="Thoát" runat="server" CausesValidation="False"
                                OnClick="btnBack_Click"></asp:Button>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </td>
    </tr>
</table>
<asp:SqlDataSource ID="ds" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
    ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>"></asp:SqlDataSource>
